<template>
  <div>
    <router-view></router-view>
  </div>
</template>
<script>

import router from './router'

export default {
  name: 'App',
}

router.beforeEach((to, from, next) => {
  if(to.name !== 'login'){
    //判断用户是否登录成功
    let userInfo = JSON.parse(localStorage.getItem('userInfo'));
    if(userInfo && userInfo != '{}'){
      window.document.title = to.meta.title || '数字化云工厂';
    }else{
      router.push('/login');
    }
  }
  next();
})

</script>
<style lang="scss">
#app {
  font-family: MicrosoftYaHei, Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  //color: #2c3e50;
  background: #E8EEF1;
}
body{
  margin: 0;
}

</style>


